package com.echo.blog.business.messageBoard.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.echo.blog.business.messageBoard.dao.MessageBoardMapper;
import com.echo.blog.business.messageBoard.model.MessageBoard;
import com.echo.blog.business.messageBoard.service.IMessageBoardService;
import com.echo.model.constant.ConstantUtils;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 留言板表（留言功能目前默认必须先登录后才允许留言） 服务实现类
 * </p>
 *
 * @author chentl123
 * @since 2020-04-28
 */
@Service
public class MessageBoardServiceImpl extends ServiceImpl<MessageBoardMapper, MessageBoard> implements IMessageBoardService {
    @Override
    public IPage<MessageBoard> getMessageBoardPages(Page<MessageBoard> page) {
        QueryWrapper<MessageBoard> wrapper = new QueryWrapper<>();
        IPage<MessageBoard> pages = this.baseMapper.selectPage(page, wrapper);
        return pages;
    }

    @Override
    public List<Map<String, Object>> getMsgBoardPagesList(Page<Map<String, Object>> page) {
        return this.baseMapper.getMsgBoardPagesList(page);
    }

    @Override
    public List<MessageBoard> getRecentMessages() {
        return this.baseMapper.getRecentMessages();
    }
}
